package com.neuedu.ylbx.controller;

import com.neuedu.ylbx.pojo.SysUser;
import com.neuedu.ylbx.service.AuthService;
import com.neuedu.ylbx.utils.ResultVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/auth")
@CrossOrigin
@Api(tags = "客户管理")
public class AuthController {
    @Autowired
    private AuthService authService;

    @ApiOperation("用户登录接口")
    @ApiImplicitParams({
            @ApiImplicitParam(dataType = "string",name = "username", value = "用户登录账号",required =true),
            @ApiImplicitParam(dataType = "string",name = "password", value = "用户登录密码",required =true)
    })
    @GetMapping("/login")
    public ResultVo<SysUser> login(String username, String password) throws Exception{
        return authService.login(username,password);
    }
}
